package cn.bdqn.service.order;

import cn.bdqn.dao.order.OrderReportFormMapper;
import cn.bdqn.dao.order.UserOrderMapper;
import cn.bdqn.pojo.order.OrderReportForms;
import cn.bdqn.utils.Json;
import cn.bdqn.utils.Page;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Slf4j
@Service
public class OrderReportFormsService {
    @Autowired
    private OrderReportFormMapper reportFormMapper;

    /**
     * 分页,模糊查询所有订单
     * @param page
     * @return
     */
    public Json getAllRoder(Page page) {
        log.info("page信息为-----------"+page.toString());
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        List<OrderReportForms> orderReportForms = reportFormMapper.getOrderReportForm(page.getRoleId(),page.getPhone(),page.getOrderType(),page.getName(),page.getStartTime(),page.getEndTime());
        PageInfo<OrderReportForms> orderReportFormsPageInfo = new PageInfo<>(orderReportForms);
        if(orderReportForms == null){
            return Json.fall("查询失败");
        }
        return Json.ok(orderReportFormsPageInfo);
    }
}
